package health.lm.com.home.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.lm.sjy.titlebar.widget.CommonTitleBar;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import health.lm.com.component_base.base.adapter.BaseFragmentAdapter;
import health.lm.com.component_base.base.mvp.activity.XActivity;
import health.lm.com.home.R;
import health.lm.com.home.R2;
import health.lm.com.home.fragment.NoticesBusinessFragment;
import health.lm.com.home.fragment.NoticesHChainFragment;
import health.lm.com.router.ARouterConstant;

/**
 * Created by Android Studio .
 * Project：hlian health.lm.com.home.activity
 * Date：2019/8/7 16:08
 * Introduce：通知消息页面
 */
@Route(path = ARouterConstant.NoticesActivity)
public class NoticesActivity extends XActivity {
    @BindView(R2.id.title_bar)
    CommonTitleBar mTitleBar;
    @BindView(R2.id.tabLayout2)
    TabLayout mTabLayout2;
    @BindView(R2.id.container)
    ViewPager mContainer;

    @Override
    public int getLayoutId() {
        return R.layout.activity_notices;
    }

    @Override
    public Object newP() {
        return null;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mTitleBar.setListener((v, action, extra) -> finish());
        mTitleBar.getCenterTextView().setText("通知消息");
        mTitleBar.getCenterTextView().setTextColor(ContextCompat.getColor(context,R.color.black));
        List<String> title = new ArrayList<>();
        title.add("会链通知");
        title.add("商会通知");
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new NoticesHChainFragment());
        fragments.add(new NoticesBusinessFragment());

        BaseFragmentAdapter fragmentAdapter = new BaseFragmentAdapter(getSupportFragmentManager(), fragments, title);
        mContainer.setAdapter(fragmentAdapter);
        mTabLayout2.setupWithViewPager(mContainer);
    }
}
